package mlz.d_object;

import java.util.Objects;

public class DemoTest03 {
    public static void main(String[] args) {
        String s1 = null;
        String s2 = "hello";

        //System.out.println(s1.equals(s2));//NullPointerException
        System.out.println(Objects.equals(s1,s2));//false

        //判断对象是否为null  等同于==
        System.out.println(Objects.isNull(s1));
        System.out.println(s1 == null);

        //判断对象是否不为null 等同于!=
        System.out.println(Objects.nonNull(s1));
        System.out.println(s1 != null);

    }
}
